<!DOCTYPE html>
<html lang="zh-cn" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title></title>
    <link rel="stylesheet" href="/css/pintuer.css">
    <link rel="stylesheet" href="/css/admin.css">
    <script src="/js/jquery.js"></script>
    <script src="/js/pintuer.js"></script>
    <script src="/js/vuejs-2.5.16.js"></script>
    <script src="/js/axios-0.18.0.js"></script>


</head>
<body>
<div class="panel admin-panel" id="questionOptionDiv">
    <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>编辑问题选项</strong></div>
    <div class="body-content">
        <form method="post" class="form-x" action="/questionOptionInfo/save" enctype="multipart/form-data">
            <input type="hidden" name="id" v-model="soulQuestionOption.id">
            <input type="hidden" name="questionId" v-model="soulQuestionOption.questionId">


            <div class="form-group">
                <div class="label">
                    <label>选项：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="content" v-model="soulQuestionOption.content"
                           data-validate="required:请输入选项"/>
                    <div class="tips"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="label">
                    <label>分数：</label>
                </div>
                <div class="field">
                    <input type="text" class="input w50" name="score" v-model="soulQuestionOption.score"
                           data-validate="required:请输入分数"/>
                    <div class="tips"></div>
                </div>
            </div>



            <div class="form-group">
                <div class="label">
                    <label></label>
                </div>
                <div class="field">
                    <button class="button bg-main icon-check-square-o" type="submit" > 提交</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="module">
    const app = new Vue({
        el: '#questionOptionDiv',
        data: {
            "soulQuestionOption":{},
            "questionOptionId":""
        },
        methods: {
            // 查询问题选项的详情
            findById(questionOptionId) {
                axios.get("/question/findQuestionOptionInfoById?questionQptionId="+this.questionOptionId).then(resp => {
                    this.soulQuestionOption = resp.data;
                    console.log(this.soulQuestionOption);
                })
            },
        },
        watch: {
        },
        created() {
            //获取地址栏中?id=xxx值
            this.questionOptionId = location.search.split("?")[1].split("=")[1];
            console.log(this.questionOptionId);
            if (this.questionOptionId) {
                this.findById(this.questionOptionId);
            }
        }
    })

</script>
<script src="/js/laydate/laydate.js"></script>
<script>
    lay('#version').html('-v' + laydate.v);
    //执行一个laydate实例
    laydate.render({
        elem: '#showTime' //指定元素
    });
</script>
</body>
</html>